<template>
  <div>
    <h1>订单管理</h1>
    <!--表格-->
    <el-table :data="iPage.records" border style="width: 100%">
      <el-table-column prop="id" label="订单号" width="180"/>
      <el-table-column prop="total" label="订单总价"/>
      <el-table-column prop="status" label="订单状态"/>
      <el-table-column prop="date" label="下单时间"/>

      <el-table-column label="操作">
        <template #default="scope">
          <el-button size="small" @click="$router.push({name:'/manager/orderDetail',query:{id:scope.row.id}})">订单详情
          </el-button>
        </template>
      </el-table-column>
    </el-table>


    <el-row>
      <!--分页-->
      <el-pagination
          v-model:currentPage="iPage.current"
          v-model:page-size="iPage.size"
          background
          layout="prev, pager, next, jumper"
          :total="iPage.total"
          @current-change="pageClick"
      />
    </el-row>


    <el-row>
      <el-col :span="8">
        订单状态：
        <el-select v-model="params.status"  placeholder="请选择状态" >
        <el-option label="不限" value=""/>
        <el-option label="未发货" value="未发货"/>
        <el-option label="发货中" value="发货中"/>
        <el-option label="已完结" value="已完结"/>
      </el-select>
        <br>
        起始日期：<el-date-picker
          v-model="params.startDate"
          type="date"
          placeholder="请选择日期"
          value-format="YYYY-MM-DD"
      />
        <br>
        结束日期：<el-date-picker
          v-model="params.endDate"
          type="date"
          placeholder="请选择日期"
          value-format="YYYY-MM-DD"
      />
        <br>
        <el-button type="info" @click="showOrder(1)">查询</el-button>
      </el-col>
    </el-row>



  </div>
</template>

<script>
import axios from "axios";

export default {
  data() {
    return {
      iPage: {},
      params: {status:""}
    }
  }, methods: {
    showOrder(pageNO) {
      this.params.pageNO=pageNO;
      axios.get("/project/order/cutByItem", {params:this.params}).then(resp => {
        this.iPage = resp.data;
      })
    }, pageClick(pageNO) {
      this.showOrder(pageNO);
    }
  }, created() {
    this.showOrder(1);
  }
}
</script>

<style scoped>
.el-row {
  margin: 20px;
}
</style>